<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>展会管理-新增/修改</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f1">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">

    <style type="text/css">
        .table-edit {
            width: 95%;
            margin-top: 20px !important;
            border: 0px;
        }

        .table-edit input[type=text] {
            border: 1px solid #e8e8e8;
        }

        .table-edit .tdL-salerManager {
            width: 18%;
            text-align: right;
            padding-right: 5px !important;
            height: 35px;
            border: 0px;
        }

        .table-edit .tdR-salerManager {
            width: 82%;
            height: 35px;
            border: 0px;
        }

        .table-edit .tdL-bigAreaManager {
            width: 18%;
            text-align: right;
            padding-right: 5px !important;
            height: 36px;
            border: 0px;
        }

        .table-edit .tdR-bigAreaManager {
            width: 82%;
            height: 36px;
            border: 0px;
        }

        .table-edit textarea {
            height: 60px;
            border: 1px solid #e8e8e8;
            padding-top: 5px !important;
            margin: 5px 0 !important;
        }

        .table-area input[type=number] {
            border: 0px;
            text-align: center;
        }

        .table-area td {
            height: 25px;
            line-height: 25px;
            border-bottom: 1px solid #e8e8e8;
            border-right: 1px solid #e8e8e8;
        }

        .table-area td .number {
            width: 30px;
            border: 0px;
            text-align: center;
            margin-left: -2px !important;
            padding-left: 0px !important;
        }

        .table-area td .number-span {
            vertical-align: middle;
            width: 15px;
            height: 15px;
            line-height: 12px;
            text-align: center;
            display: inline-block;
            cursor: pointer;
        }

        .table-edit select {
            border: 1px solid #e8e8e8;
        }

        .table-edit .day-content {
            width: 56%;
            float: right;
            height: 24px;
            line-height: 24px;
            border: 1px solid #e8e8e8;
            border-left: 0px;
        }

        .table-area .area-name-font {
            text-align: left;
            text-indent: 5px;
        }

        .table-area .row-height {
            height: 25px;
            line-height: 25px;
            overflow: hidden;
            word-break: break-all;
            word-wrap: break-word;
            text-align: left;
            width: 140px;
        }

        .table-area input {
            text-align: center;
        }

        .select2-container--bootstrap .select2-selection--single .select2-selection__arrow {
            height: 26px;
            position: absolute;
            top: 1px;
            right: 1px;
            width: 20px;
        }

        .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b {
            border-color: #888 transparent transparent transparent;
            border-style: solid;
            border-width: 5px 4px 0 4px;
            height: 0;
            left: 50%;
            margin-left: -4px;
            margin-top: -2px;
            position: absolute;
            top: 50%;
            width: 0;
        }

        .select2-container--bootstrap .select2-selection--single, .select2-selection .select2-selection--single {
            border: 1px solid #d2d6de;
            border-radius: 0;
            padding: 6px 12px;
            height: 25px !important;
        }

        .select2-container--bootstrap .select2-selection--single .select2-selection__arrow {
            height: 20px;
            right: 3px;
        }

        .select2-container--bootstrap .select2-selection--single .select2-selection__rendered {
            line-height: 22px !important;
        }
    </style>
</head>
<body>
<div class="layout" style="left:0px;top:0px;right:0px;bottom:0px;" id="edit">
    <div class="center" style="overflow:auto;overflow-x:hidden;">
        <table class="table-detail table-edit" style="border-top-width:0px;">
            <tr>
                <td :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'">展会名称：</td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'" style="text-align: left;">
                    {{exhibition.companyName}}
                </td>
            </tr>
            <tr>
                <td :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'">品牌：</td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'" style="text-align: left">
                    <select v-model="exhibition.brandId" v-if="salerManager" v-select2="" class="form-control select2"
                            style="width: 100%">
                        <option v-for="option in brandList" :value="option.id">
                            {{option.name}}
                        </option>
                    </select>
                    <span v-if="bigAreaManager || bigCusSpport">{{exhibition.brandName}}</span>
                </td>
            </tr>
            <tr>
                <td :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'">展会地点：</td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'" style="text-align: left">
                    <select v-model="exhibition.province" @change="getCityList()" style="width: 22%;float: left;"
                            v-if="salerManager">
                        <option v-for="option in provinceList" :value="option.id">
                            {{option.name}}
                        </option>
                    </select>
                    <select v-model="exhibition.city" style="width: 22%;float: left;border-left:0px"
                            v-if="salerManager">
                        <option v-for="option in cityList" :value="option.id">
                            {{option.name}}
                        </option>
                    </select>
                    <input type="text" v-model="exhibition.address" style="width: 56%;float: right;border-left:0px"
                           v-if="salerManager" placeholder="酒店名称">
                    <span v-if="bigAreaManager || bigCusSpport">{{exhibition.provinceName}}&nbsp;&nbsp;&nbsp;&nbsp;{{exhibition.cityName}}&nbsp;&nbsp;&nbsp;&nbsp;{{exhibition.address}}</span>
                </td>
            </tr>
            <tr>
                <td :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'">展会日期：</td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'" style="text-align: left">
                    <select v-model="exhibition.year" style="width: 22%;float: left;" v-if="salerManager">
                        <option value="2018">2018年</option>
                        <option value="2019">2019年</option>
                        <option value="2020">2020年</option>
                    </select>
                    <select v-model="exhibition.month" style="width: 22%;float: left;border-left:0px;"
                            v-if="salerManager">
                        <option value="1">1月</option>
                        <option value="2">2月</option>
                        <option value="3">3月</option>
                        <option value="4">4月</option>
                        <option value="5">5月</option>
                        <option value="6">6月</option>
                        <option value="7">7月</option>
                        <option value="8">8月</option>
                        <option value="9">9月</option>
                        <option value="10">10月</option>
                        <option value="11">11月</option>
                        <option value="12">12月</option>
                    </select>
                    <div class="day-content" v-if="salerManager">
                        <input type="text" v-model="exhibition.day"
                               style="width:20%; border: 0px;float: left; height: 22px" name="exhibitionDay"
                               @keyup="dayKeyup"/>
                        <span style="float: left; margin-left: 10px;">日</span>
                    </div>
                    <span v-if="bigAreaManager || bigCusSpport">{{exhibition.year}}年&nbsp;{{exhibition.month}}&nbsp;月<span
                            v-if="exhibition.day">&nbsp;{{exhibition.day}}&nbsp;日</span>
                    </span>
                </td>
            </tr>

            <tr>
                <td :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'">展会类型：</td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'" style="text-align: left;">
                    <select v-model="exhibition.type" style="text-align: left" v-if="salerManager">
                        <option value="1">大型 (200人以上）</option>
                        <option value="2">中型 (50-200人)</option>
                        <option value="3">特种行业 (不设限）</option>
                    </select>
                    <span v-if="bigAreaManager || bigCusSpport">
                        <span v-if="exhibition.type == 1">大型 (200人以上）</span>
                        <span v-if="exhibition.type == 2">中型 (50-200人)</span>
                        <span v-if="exhibition.type == 3">特种行业 (不设限）</span>
                    </span>
                </td>
            </tr>
            <tr>
                <td :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'" valign="top">备注：</td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'" style="text-align: left"
                    valign="top">
                    <textarea type="text" v-model="exhibition.remark" v-if="salerManager"></textarea>
                    <span v-if="bigAreaManager || bigCusSpport">{{exhibition.remark}}</span>
                </td>
            </tr>
            <tr v-if="salerManager || bigAreaManager || bigCusSpport">
                <td valign="top" :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'">大区目标：</td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'">
                    <table class="table-detail table-area">
                        <tr>
                            <td class="td-title" style="width: 135px;">大区</td>
                            <td class="td-title" style="width: 120px;">客户数量</td>
                            <td class="td-title" style="width: 120px;">定金目标（个）</td>
                        </tr>
                        <tr v-for="(item,i) in exhibition.aimsList" v-if="item.parentId==0">
                            <td class="area-name-font" :title="item.regionName">
                                <div class="row-height">{{item.regionName}}</div>
                                <input type="hidden" v-model="item.regionId">
                            </td>
                            <td>
                                <span class="number-span less" v-if="salerManager|| bigCusSpport"
                                      @click="lessCustomer(item.customNum,i)">-</span>
                                <span v-if="bigAreaManager">{{item.customNum}}</span>
                                <input type="text" v-if="salerManager || bigCusSpport" v-model="item.customNum"
                                       @change="bigRegionNumChange()"
                                       class="number"/>
                                <span class="number-span plus" v-if="salerManager|| bigCusSpport"
                                      @click="plusCustomer(item.customNum,i)">+</span>
                            </td>
                            <td>
                                <span class="number-span less" v-if="salerManager|| bigCusSpport"
                                      @click="lessDeposit(item.depositNum,i)">-</span>
                                <span v-if="bigAreaManager">{{item.depositNum}}</span>
                                <input type="text" v-if="salerManager|| bigCusSpport" v-model="item.depositNum"
                                       @change="bigRegionNumChange()"
                                       class="number"/>
                                <span class="number-span plus" v-if="salerManager|| bigCusSpport"
                                      @click="plusDeposit(item.depositNum,i)">+</span>
                            </td>
                        </tr>
                        <tr v-if="this.salerManager">
                            <td>合计</td>
                            <td>{{exhibition.bigCustomerNumTotal}}</td>
                            <td>{{exhibition.bigDepositNumTotal}}</td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr v-if="(salerManager && noManagerRegionExist) || bigAreaManager">
                <td valign="top" :class="salerManager ? 'tdL-salerManager':'tdL-bigAreaManager'">
                    <div style="margin-top: 17px">小区目标：</div>
                </td>
                <td :class="salerManager ? 'tdR-salerManager':'tdR-bigAreaManager'"
                    style="padding-top: 15px !important;">
                    <table class="table-detail table-area">
                        <tr>
                            <td class="td-title" style="width: 140px;">小区</td>
                            <td class="td-title" style="width: 120px;">客户数量</td>
                            <td class="td-title" style="width: 120px;">定金目标（个）</td>
                        </tr>
                        <tr v-for="(item,i) in exhibition.aimsList" v-if="item.parentId!=0">
                            <td class="area-name-font " :title="item.regionName">
                                <div class="row-height"> {{item.regionName}}</div>
                                <input type="hidden" v-model="item.regionId">
                            </td>
                            <td>
                                <span class="number-span less" @click="lessCustomerSmall(item.customNum,i)">-</span>
                                <input type="text" v-model="item.customNum" @change="smallRegionNumChange()"
                                       class="number"/>
                                <span class="number-span plus" @click="plusCustomerSmall(item.customNum,i)">+</span>
                            </td>
                            <td>
                                <span class="number-span less" @click="lessDepositSmall(item.depositNum,i)">-</span>
                                <input type="text" v-model="item.depositNum" @change="smallRegionNumChange()"
                                       class="number"/>
                                <span class="number-span plus" @click="plusDepositSmall(item.depositNum,i)">+</span>
                            </td>
                        </tr>
                        <tr>
                            <td>合计</td>
                            <td>{{exhibition.smallCustomerNumTotal}}</td>
                            <td>{{exhibition.smallDepositNumTotal}}</td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <br/>
    </div>
    <div class="south" style="height:50px;line-height:50px;text-align:center;" v-if="exhibition.isModify">
        <input type="button" value="保存" class="btn oaBtn btn-sm" @click="save()"/>
    </div>
</div>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script type="text/javascript" src="/dist/plugins/select2/select2.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    var api = frameElement.api, W = api.opener;
    Vue.directive('select2', {
        inserted: function (el, binding, vnode) {
            var options = binding.value || {};

            $(el).select2(options).on("select2:select", function (e) {
                el.dispatchEvent(new Event('change', {target: e.target})); //说好的双向绑定，竟然不安套路
            });
        },
        update: function (el, binding, vnode) {
            $(el).trigger("change");
        }
    });
    var edit = new Vue({
        el: "#edit",
        data: {
            currentUser: getCurrentUser(),
            pageType: "add",
            id: "",
            exhibition: {
                id: '0',
                brandId: '',
                province: '',
                city: '',
                address: '',
                year: '',
                month: '',
                day: '',
                type: '',
                remark: '',
                companyId: getCurrentUser().companyId,
                companyName: getCurrentUser().companyName,
                createUserId: getCurrentUser().id,
                aimsList: [],
                bigCustomerNumTotal: 0,
                bigDepositNumTotal: 0,
                smallCustomerNumTotal: 0,
                smallDepositNumTotal: 0,
                isBigAreaManager: '0',
                brandName: '',
                provinceName: '',
                cityName: '',
                isModify: true
            },
            rightOpENames: [],
            salerManager: false,
            bigAreaManager: false,
            bigCusSpport: false,
            bigRegionIds: [],
            brandList: [],
            provinceList: [],
            cityList: [],
            noManagerRegion: {},
            noManagerRegionExist: false
        },
        methods: {
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.exhibition.exhibitionDate = dp.cal.getNewDateStr();
                        return true;
                    }
                });
                $(e.target).blur();
            },
            lessCustomer: function (num, i) {
                if (num <= 0)
                    return;
                this.exhibition.aimsList[i].customNum--;
                this.bigRegionNumChange();
            },
            plusCustomer: function (num, i) {
                this.exhibition.aimsList[i].customNum++;
                this.bigRegionNumChange();
            },
            lessDeposit: function (num, i) {
                if (num <= 0)
                    return;
                this.exhibition.aimsList[i].depositNum--;
                this.bigRegionNumChange();
            },
            plusDeposit: function (num, i) {
                this.exhibition.aimsList[i].depositNum++;
                this.bigRegionNumChange();
            },
            lessCustomerSmall: function (num, i) {
                if (num <= 0)
                    return;
                this.exhibition.aimsList[i].customNum--;
                this.smallRegionNumChange();
            },
            plusCustomerSmall: function (num, i) {
                this.exhibition.aimsList[i].customNum++;
                this.smallRegionNumChange();
            },
            lessDepositSmall: function (num, i) {
                if (num <= 0)
                    return;
                this.exhibition.aimsList[i].depositNum--;
                this.smallRegionNumChange();
            },
            plusDepositSmall: function (num, i) {
                this.exhibition.aimsList[i].depositNum++;
                this.smallRegionNumChange();
            },
            bigRegionNumChange: function () {
                var bigCustomerNumTotal = 0;
                var bigDepositNumTotal = 0;
                for (var i = 0; i < this.exhibition.aimsList.length; i++) {
                    if (this.exhibition.aimsList[i].parentId == 0) {
                        bigCustomerNumTotal += parseInt(this.exhibition.aimsList[i].customNum);
                        bigDepositNumTotal += parseInt(this.exhibition.aimsList[i].depositNum);
                    }
                }
                this.exhibition.bigCustomerNumTotal = bigCustomerNumTotal;
                this.exhibition.bigDepositNumTotal = bigDepositNumTotal;
            },
            smallRegionNumChange: function () {
                var smallCustomerNumTotal = 0;
                var smallDepositNumTotal = 0;
                for (var i = 0; i < this.exhibition.aimsList.length; i++) {
                    if (this.exhibition.aimsList[i].parentId != 0) {
                        smallCustomerNumTotal += parseInt(this.exhibition.aimsList[i].customNum);
                        smallDepositNumTotal += parseInt(this.exhibition.aimsList[i].depositNum);
                    }
                }
                this.exhibition.smallCustomerNumTotal = smallCustomerNumTotal;
                this.exhibition.smallDepositNumTotal = smallDepositNumTotal;
            },
            save: function () {
                if (this.exhibition.address == "") {
                    alert("请填写展会地址");
                    return;
                }
                if (this.exhibition.exhibitionDate == "") {
                    alert("请填写展会日期");
                    return;
                }
                $.wyui.postMethod(urlConfig.crm.exhibition.save, this.exhibition, function (data) {
                    alert("操作成功");
                    parent.app.refresh();
                    api.close();
                });
            },
            getCityList: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.system.province.getProvinceByParentId, {
                    parentId: that.exhibition.province
                }, function (list) {
                    that.cityList = list;
                });
            },
            close: function () {
                api.close();
            },
            dayKeyup: function () {
                //如果输入非数字，则替换为''
                this.exhibition.day = this.exhibition.day.replace(/[^\d]/g, '');
                var reg = new RegExp("^\d{2}$");
                if (!reg.test(this.exhibition.day)) {
                    this.exhibition.day = this.exhibition.day.substr(0, 2);
                }
            }

        },
        mounted: function () {
            //页面操作状态
            this.pageType = $.wyui.page.urlParams.pageType;
            this.id = $.wyui.page.urlParams.id;
            var that = this;
            //权限@
            $.wyui.postMethod(urlConfig.system.rightOp.getRightOpByUserId, {userId: getCurrentUser().id}, function (rightOps) {
                for (var i = 0; i < rightOps.length; i++) {
                    that.rightOpENames.push(rightOps[i].eName);
                }
                if ($.inArray('SalerManager', that.rightOpENames) > -1) {
                    that.salerManager = true;
                }
                if ($.inArray('BigAreaManager', that.rightOpENames) > -1) {
                    that.bigAreaManager = true;
                    that.exhibition.isBigAreaManager = "1";
                }
                if ($.inArray('bigCusSpport', that.rightOpENames) > -1) {
                    that.bigCusSpport = true;
                }
            }, true);

            if (that.salerManager) {
                $.wyui.postMethod(urlConfig.crm.exhibition.getNomanagerRegion, {userId: currentUser.id}, function (data) {
                    $(data).each(function (i, item) {
                        that.noManagerRegion[item.id] = true;
                        that.noManagerRegionExist = true;
                    });
                }, true);
            }

            //销售管理经理、大区经理：读取大区
            if (that.salerManager || that.bigAreaManager) {
                $.wyui.postMethod(urlConfig.system.region.getBigRegionListByUserId, {
                    userId: getCurrentUser().id,
                    isBigRegion: "1"
                }, function (list) {
                    that.bigRegionList = list;
                    for (var i = 0; i < that.bigRegionList.length; i++) {
                        if (that.pageType == "add") {
                            var o = new Object();
                            o.regionId = that.bigRegionList[i].id;
                            o.regionName = that.bigRegionList[i].name;
                            o.parentId = that.bigRegionList[i].parentId;
                            o.customNum = "0";
                            o.depositNum = "0";
                            that.exhibition.aimsList.push(o);
                        }
                        that.bigRegionIds.push(that.bigRegionList[i].id);
                    }

                }, true);
            }

            //大区经理：读取小区
            if (that.bigAreaManager || that.salerManager) {
                $.wyui.postMethod(urlConfig.system.region.getBigRegionListByUserId, {
                    userId: getCurrentUser().id,
                    isBigRegion: "0"
                }, function (list) {
                    that.smallRegionList = list;
                    for (var i = 0; i < that.smallRegionList.length; i++) {
                        var o = new Object();
                        o.regionId = that.smallRegionList[i].id;
                        o.regionName = that.smallRegionList[i].name;
                        o.parentId = that.smallRegionList[i].parentId;
                        o.customNum = "0";
                        o.depositNum = "0";

                        if (!that.noManagerRegion[o.regionId] && that.noManagerRegionExist)
                            continue;

                        that.exhibition.aimsList.push(o);
                    }
                }, true);
            }

            //编辑展会-展示信息
            if (this.pageType == "edit" && (that.salerManager || that.bigAreaManager || that.bigCusSpport)) {
                $.wyui.postMethod(urlConfig.crm.exhibition.getById, {
                    id: that.id
                }, function (data) {
                    that.exhibition.id = data.exhibition.id;
                    that.exhibition.name = data.exhibition.name;
                    that.exhibition.address = data.exhibition.address;
                    that.exhibition.remark = data.exhibition.remark;
                    that.exhibition.createUserId = data.exhibition.createUserId;
                    that.exhibition.companyId = data.exhibition.companyId;
                    that.exhibition.companyName = data.exhibition.companyName;
                    that.exhibition.brandId = data.exhibition.brandId;
                    that.exhibition.province = data.exhibition.regionId.substring(0, 2);
                    that.exhibition.city = data.exhibition.regionId;
                    that.exhibition.year = data.exhibition.exhibitionDate.split('-')[0];
                    that.exhibition.month = data.exhibition.exhibitionDate.split('-')[1];
                    that.exhibition.day = data.exhibition.exhibitionDate.split('-')[2];
                    that.exhibition.type = data.exhibition.type;
                    that.exhibition.provinceName = data.exhibition.provinceName;
                    that.exhibition.cityName = data.exhibition.cityName;
                    that.exhibition.brandName = data.exhibition.brandName;
                    //判断展会开始前10天，不能修改展会信息
                    var exhibitionDate = data.exhibition.exhibitionDate;
                    if (exhibitionDate.length >= 8) {
                        exhibitionDate = exhibitionDate.replace(/-/g, "/");//展会日期
                        var d2 = new Date();//今天的日期
                        var d1 = new Date(Date.parse(exhibitionDate));
                        var days = d1.getTime() - d2.getTime();
                        var time = parseInt(days / (1000 * 60 * 60 * 24));//相差天数
                        if (time <= 1) {
                            that.exhibition.isModify = false;
                        }
                    }

                    getBigCusDepart();

                    for (var i = 0; i < data.aimsList.length; i++) {
                        var aimsList =data.aimsList[i];
                        var o = new Object();
                        o.regionId = aimsList.regionId;
                        o.regionName = aimsList.regionName;
                        o.parentId = aimsList.parentId;
                        o.customNum = aimsList.customNum;
                        o.depositNum = aimsList.depositNum;
                        if (that.bigAreaManager || that.salerManager || that.bigCusSpport) {
                            //大区经理区域
                            if ($.inArray(aimsList.regionId, that.bigRegionIds) > -1 && aimsList.parentId == '0') {
                                that.exhibition.aimsList.push(o);
                            } else if (aimsList.parentId != '0' || that.bigCusSpport) {
                                for (var j = 0; j < that.exhibition.aimsList.length; j++) {
                                    if (aimsList.regionId == that.exhibition.aimsList[j].regionId) {
                                        that.exhibition.aimsList[j].customNum = aimsList.customNum;
                                        that.exhibition.aimsList[j].depositNum = aimsList.depositNum;
                                    }
                                }
                            }
                        }
                    }
                }, true);
            }

            function getBigCusDepart() {
                //大客户支持获取大客户区域
                if (that.bigCusSpport) {
                    $.wyui.postMethod(urlConfig.crm.exhibition.getBigCusDepart, {
                        companyId: that.exhibition.companyId
                    }, function (data) {
                        var bigCusDepart = data.bigCusDepart;
                        var bigCusReginon = data.bigCusReginon;
                        if (bigCusDepart != undefined && bigCusDepart != null) {
                            var o = new Object();
                            o.regionId = bigCusDepart.ID;
                            o.regionName = bigCusDepart.NAME;
                            o.parentId = bigCusDepart.PARENT_ID;
                            o.customNum = "0";
                            o.depositNum = "0";
                            that.exhibition.aimsList.push(o);
                        }
                    }, true);
                }
            }


            this.bigRegionNumChange();
            this.smallRegionNumChange();

            //设备型号
            $.wyui.postMethod(urlConfig.crm.exhibition.getBrandList, {}, function (list) {
                that.brandList = list.records;
            }, true);
            //省份
            $.wyui.postMethod(urlConfig.system.province.getProvinceByParentId, {
                parentId: "0"
            }, function (list) {
                that.provinceList = list;
            }, true);
            //城市
            if (that.pageType == "edit") {
                $.wyui.postMethod(urlConfig.system.province.getProvinceByParentId, {
                    parentId: that.exhibition.province
                }, function (list) {
                    that.cityList = list;

                }, true);
            }
            $(".select2").select2();
        }
    });
</script>
</body>
</html>